/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import { getApplicantUpdate } from '@/services/finance_receipt';
import { ModalForm, ProFormText } from '@ant-design/pro-form';
import { message } from 'antd';
import React from 'react';

const PostWaybill: React.FC<{
  id: string;
  status: number;
  callback: () => void;
  default?: string;
}> = (props) => {
  return (
    <ModalForm
      title='请填写单号'
      trigger={<a>单号</a>}
      width={400}
      modalProps={{
        destroyOnClose: true,
        footer: null,
        centered: true,
      }}
      onFinish={async ({ waybill_no }) => {
        if (!waybill_no) {
          message.error('请填写单号');
          return false;
        }
        const { code } = await getApplicantUpdate({ ...props, waybill_no });
        return code == 0;
      }}
    >
      <ProFormText initialValue={props.default} name='waybill_no' placeholder={'请填写单号'} />
    </ModalForm>
  );
};

export default PostWaybill;
